public class hello {

        public static void main(String[] args) {

    
    // 初始数组

    
            int[] intArray = {1, -2, 3,-2,5,1};

    
            int left = 0; // 从左边开始计算
    
            int leftTemp = 0; // 左边现在指向的位置
    
            int leftSum = 0; // 左边的总和

    
    // 右边变量，同上

    
            int right = intArray.length - 1;

    
            int rightTemp = intArray.length - 1;
   
            int rightSum = 0;
 
    
    // 最终总和

    
            int sum = 0;

    
            while(true) {

    // 从左往右计算，每次往后移动一位

    
                if (leftSum + intArray[leftTemp] <= 0) {

    
                    leftTemp++;

    
                    left = leftTemp;

    
                    leftSum = 0;

    
                } else {

    
                    leftSum += intArray[leftTemp];

    
                    leftTemp++;
 
    
                }

    // 从右往左计算，每次往前移动一位

                if (rightSum + intArray[rightTemp] <= 0) {

    
                    rightTemp--;

    
                    right = rightTemp;

                    rightSum = 0;
    
                } else {
    
                    rightSum += intArray[rightTemp];
    
                    rightTemp--;
            int x,y;
            int count=0;
            for(x=2;x<=20000;x++) {
                boolean flag=true;
                for(y=2;y<x;y++) {
                    if(x%y==0) {
                        flag=false;
                        break;
    
                    }
                }
    
    // 前后相遇时进行相应处理
    
                if (rightTemp - leftTemp == -2) {
    
                    sum = leftSum + rightSum - intArray[rightTemp];
    
                    break;
    
                } else if (rightTemp - leftTemp == -1) {
                    sum = leftSum + rightSum;
                    break;
                if(flag) {
    
                    count++;
    
                    System.out.print(y+"\t");
    
                    if(count%5==0)

                        System.out.println();

                }
            }

            System.out.print("The Max Child Array is : ");
    
            for (int i = left; i <= right; i++) {
                System.out.print(intArray[i] + " ,");
            }
            System.out.println("\nSummery is " + sum);
 
        }

    }
}
        }
    }